﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DalatCooking.Core;

public partial class Role_Default : System.Web.UI.Page
{


    private void Page_Load(object sender, System.EventArgs e)
    {
        if (Context.User.Identity.IsAuthenticated)
        {
            if (!(Context.User is CustomPrincipal))
            {
                // ASP.NET's regular forms authentication picked up our cookie, but we
                // haven't replaced the default context user with our own. Let's do that
                // now. We know that the previous context.user.identity.name is the e-mail
                // address (because we forced it to be as such in the login.aspx page)				
                CustomPrincipal newUser = new CustomPrincipal(Context.User.Identity.Name);
                Context.User = newUser;
            }
        }
        if (!Page.IsPostBack)
        {
            UsersRepeater.DataSource = PersonManager.FindAll();
            UsersRepeater.DataBind();
        }
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        base.OnInit(e);
        InitializeComponent();
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.Load += new System.EventHandler(this.Page_Load);
    }
    #endregion
}